/*
 * DifferentShaderConstructors.h
 *
 *  Created on: 12.05.2012
 *      Author: Kirill Blinov
 *       Copyright: LGPL
 *
 * This file contains classes to implement different shader types
 * through its input parameters.
 */

#ifndef DIFFERENTSHADERCONSTRUCTORS_H_
#define DIFFERENTSHADERCONSTRUCTORS_H_

#include "CVisualisator.h"

enum SHADER_PARAM_TYPES
{
	SHADER_INPUT_BASIC_VALUES = 0,
	SHADER_INPUT_UINT,
	SHADER_INPUT_INT,
	SHADER_INPUT_FLOAT,
	SHADER_INPUT_VEC3,
	SHADER_INPUT_VEC4,
	SHADER_INPUT_MAT4,
	SHADER_INPUT_SINUS_CALLBACK
};

class IShaderParamParser
{
protected:
	IShaderParamParser(){};
	virtual ~IShaderParamParser(){};

public:
	/*
	 * This function recognizes a shader parameter and try to submit its value
	 * Every inhered class should implement it.
	 *  Returns FALSE if a parameter type isn't handled in current implementation
	 */
	virtual bool TryToApplyParameter( const size_t VariablePosition,
                                      const size_t ValuePosition,
                                      const std::string TokenString,
									  IShaderProgram *ShaderProgram,
									  const std::vector< std::string > SortedShaderTextures,
                                      bool *Result = NULL ) const = 0;

};

//---------------------------------------------------//

class CParseCommonInputValues : public IShaderParamParser
{
public:
	CParseCommonInputValues(){};
	virtual ~CParseCommonInputValues(){};

	virtual bool TryToApplyParameter( const size_t TypePosition,
                                      const size_t ValuePosition,
                                      const std::string TokenString,
									  IShaderProgram *ShaderProgram,
									  const std::vector< std::string > SortedShaderTextures,
                                      bool *Result = NULL ) const;
};

//--------------------------------------------------//

class CParseNativeInputTypes : public IShaderParamParser
{
public:
	CParseNativeInputTypes(){};
	virtual ~CParseNativeInputTypes(){};

	virtual bool TryToApplyParameter( const size_t VariablePosition,
                                      const size_t ValuePosition,
                                      const std::string TokenString,
									  IShaderProgram *ShaderProgram,
									  const std::vector< std::string > SortedShaderTextures,
                                      bool *Result = NULL ) const;
};

//--------------------------------------------------//

class CParseSinCallbac : public IShaderParamParser
{
private:
	float Callback( float Step, boost::shared_ptr<float> Accumulator ) const;

public:
	CParseSinCallbac(){};
	virtual ~CParseSinCallbac(){};

	virtual bool TryToApplyParameter( const size_t TypePosition,
                                      const size_t ValuePosition,
                                      const std::string TokenString,
									  IShaderProgram *ShaderProgram,
									  const std::vector< std::string > SortedShaderTextures,
                                      bool *Result = NULL ) const;
};

//--------------------------------------------------//

#endif /* DIFFERENTSHADERCONSTRUCTORS_H_ */
